<script src="{$this->data['baseurl']}js/multiselect.js"></script>
<script src="{$this->data['baseurl']}js/category.js?{rand(0,10000)}"></script>
<script type="text/javascript">
var category_id	= {if $this->data['info']}{$this->data['info']['pid']}{else}0{/if};
var successFun=function(res){
if(res.code==200){
	document.location	= res.data.forward;
}else{
	alert('出错了，请重新尝试！');
}
}
$(document).ready(function() { 
	var updateOptions	= {dataType:'json',error:doError,success:doSuccess}
    $('#form').ajaxForm(updateOptions);
    
    var multiSelect		= new MultiSelect('divCategorySelect','hd_category_id',dataMultiCategory,dataAllCategory);
	multiSelect.init();
	multiSelect.select(category_id);
}); 
</script>
<div id="content">
<form id="form" action="{url('Category','SaveEdit')}" method="post">
<h3 class="title">{if $this->data['id']>0}修改{else}添加{/if}商品类目</h3>
<table class="admin-table">
	<tr>
	<td>上级类目</td>
	<td>
<span id="divCategorySelect"></span>
<input type="hidden" name="pid" id="hd_category_id" value="{if $this->data['info']}{$this->data['info']['pid']}{else}0{/if}" />
<span etype='error_info' class="error_info" id="pid_info"></span>
	</td>
	</tr>
	<tr>
	<td>类目ID</td>
	<td>
<input name="id" id="id" type="text" {if $this->data['info']}value="{$this->data['info']['id']}" readonly{/if} /><span etype='error_info' class="error_info" id="id_info">必须对应淘宝的类目ID</span>
	</td>
	</tr>
	<tr>
	<td>类目名称</td>
	<td>
<input name="name" id="name" type="text" {if $this->data['info']}value="{$this->data['info']['name']}"{/if} /><span etype='error_info' class="error_info" id="name_info"></span>
	</td>
	</tr>
	<tr>
	<td>显示顺序</td>
	<td>
<input name="orderby" id="orderby" type="text" value="{if $this->data['info']}{$this->data['info']['orderby']}{else}0{/if}" />
<span etype='error_info' class="error_info" id="orderby_info">数字越大排在越前面</span>
	</td>
	</tr>
	<tr><td colspan="2"><input id="btnSave" type="submit" value="保存" /><input type="hidden" value="{$this->data['id']}" name="oid" /></td></tr>
</table>
</form>
</div>